<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    // 1.循环退出
    let i = 1
    while (i <= 10) {
      if (i === 5) {
        break // 退出整个循环
      }
      document.write(i + '<br>')
      i++
    }
    document.write('-------------'+'<br>')
    // 2.循环继续
    let j = 1
    while (j <= 10) {
      if (j === 5) {
        j++ //如果不写，j会一直等于5，死循环
        continue // 退出本次循环，继续下一次循环
      }
      document.write(j + '<br>')
      j++
    }
    document.write('-------------'+'<br>')
    // 3.你爱我嘛
    while (true) {
      answer = prompt('你爱我嘛?')
      if (answer === '爱') {
        break
      }
    }
    document.write('我也爱你')
  </script>
</body>
</html>